/**
 * Project: common-cps
 * Created: 2017年2月6日
 * Copyright ©2011-2017 gopay Information Technology Co., LTD All Rights Reserved
**/
package com.gopay.common.cps.dao.cbrmb.impl;

import java.math.BigInteger;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.constants.cbrmb.CbRmbEnvironment;
import com.gopay.common.cps.dao.cbrmb.CbRmbAllocationBankInfoDAO;
import com.gopay.common.domain.cbrmb.CbRmbAllocationBankInfo;

/** 
 * @ClassName: CbRmbAllocationBankInfoDAOImpl 
 * @author junjie.ge 
 * @date 2017年2月6日 下午2:02:59  
 */
@Repository("cbRmbAllocationBankInfoDAO")
public class CbRmbAllocationBankInfoDAOImpl extends BaseDAOImpl<CbRmbAllocationBankInfo, BigInteger>
        implements CbRmbAllocationBankInfoDAO {

    @Override
    public CbRmbAllocationBankInfo findByEnvironment(CbRmbEnvironment env) {
        String hql = "from CbRmbAllocationBankInfo where environment = :envStr";
        Map<String, Object> param = new HashMap<>();
        param.put("envStr", env.getEnv());
        List<CbRmbAllocationBankInfo> list = super.findByHql(hql, param);
        if (list != null && !list.isEmpty()) {
            return list.get(0);
        }
        return null;
    }

}
